<template>
	<view class="content">
		<view class="block">
			<view class="info1" style="padding-top: 0;">
				<text>新密码</text>
				<input type="number" value="" v-model="password1"  placeholder="请设置您的新密码" />
			</view>
			<view class="info1">
				<text>确认密码</text>
				<input type="number" value="" v-model="password2" placeholder="再次输入密码" />
			</view>
		</view>
		<view class="queren" @click="chgPwd">保存设置</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			type: '', // 类型 1设置 ；2修改
			password1: '', // 密码
			password2: '', // 确认密码
			code: '' // 验证码（修改密码时必填）
		};
	},
	onLoad(e) {
		console.log('e :>> ', e);
		this.code = e.code
		this.type = uni.getStorageSync("type")
		console.log('this.type :>> ', this.type);
		
	},
	onShow() {},
	methods: {
		//设置/修改密码
		async chgPwd() {
			const res = await this.$u.post(
				'api/User/passwordPost',
				{ 
					type: this.type,
					password1: this.password1,
					password2: this.password2,
					code: this.code,
					
					},
				{
					'XX-Token': uni.getStorageSync('token'),
					'XX-Device-Type': 'wxapp'
				}
			);
			if (!res.code) return uni.$showMsg(res.msg);

			uni.$showMsg(res.msg);
			uni.switchTab({
				url:"../my"
			})
			console.log('res :>> ', res);
		},
		
	}
};
</script>

<style lang="scss" scoped>
.content {
	padding: 30rpx 20rpx;

	.queren {
		width: 630rpx;
		height: 88rpx;
		background: #671729;
		border-radius: 44rpx;
		text-align: center;
		line-height: 88rpx;
		margin: 0 auto;
		font-size: 36rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #ffffff;
		margin-top: 320rpx;
	}
	.block {
		width: 690rpx;
		//height: 401rpx;
		background: #ffffff;
		border-radius: 10rpx;
		padding: 31rpx 42rpx;

		.info1 {
			padding-top: 70rpx;
			text {
				height: 31rpx;
				font-size: 32rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #333333;
				line-height: 36rpx;
			}
			input {
				margin-top: 20rpx;
				height: 70rpx;
				line-height: 70rpx;
				border-bottom: 1rpx solid #e6e6e6;
			}
		}
	}
}
</style>
